package tgc.edu.zz.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import tgc.edu.zz.entity.SysUser;
import tgc.edu.zz.security.UserUtils;

@Controller
public class LoginController {
	@Autowired
	private UserUtils UserUtils;

	@RequestMapping(value= {"/login","/"},method=RequestMethod.GET)
	public String login() {
		return "login";
	}
	@RequestMapping(value = "/main")
	public String main() {
		SysUser user = UserUtils.getUser();
		if(user==null) {
			return "redirect:login";
		}
		return "main";
	}
	
}
